package com.caesar.Exception;

import java.util.Scanner;

/**
 * @author caesar
 * @date 2025/7/14
 * @Description:
 * @apiNote
 */
public class prac1 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        int a;
        while (true) {
            try {
                System.out.print("请输入被除数整数：");
                a = input.nextInt();
                break;
            } catch (Exception e) {
                input.nextLine();
                System.out.println("输入错误，请重新输入！");
            }
        }
        int b;
        while (true) {
            try {
                System.out.print("请输入除数整数：");
                b = input.nextInt();
                if (b == 0) {
                    System.out.println("除数不能为0，请重新输入");
                } else {
                    break;
                }
            } catch (Exception e) {
                input.nextLine();
                System.out.println("输入错误，请重新输入！");
            }
        }

        System.out.println("a / b = "+ a / b);

        input.close();
    }
}
